package com.ybwh.springboot2.conf;

import java.io.IOException;
 
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.SingleServerConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
//@Configuration
public class RedissonConfig {
	@Bean(destroyMethod = "shutdown")
	RedissonClient redisson() throws IOException {
		Config config = new Config();
		//config.useClusterServers().addNodeAddress("127.0.0.1:6379");
		SingleServerConfig c = config.useSingleServer();
		c.setAddress("redis://127.0.0.1:6379");
		c.setPassword("123456");
		c.setDatabase(0);

		return Redisson.create(config);
	}
}
